home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / ubas830.zip / RK.UB < prev    next >
Text File  |  1989-03-02  |  540b  |  22 lines

  1.    10   print fnRk(&fnY(),0,1,log(50+100*#i),100)
  2.    20   end
  3.    30   '
  4.    40   fnY(X,Y)
  5.    50   return(Y)
  6.    60   '
  7.    70   ' Runga Kutta for y'=f(x,y), y(x0)=y0, integrating in N equal
  8.    80   ' steps from x0 to x.
  9.    90   fnRk(&fnF(),X0,Y0,X,N)
  10.   100   local H,I,K0,K1,K2,K3
  11.   110   H=(X-X0)/N/2
  12.   120   for I=1 to N
  13.   130   K0=fnF(X0,Y0)
  14.   140   X0+=H
  15.   150   K1=fnF(X0,Y0+H*K0)
  16.   160   K2=fnF(X0,Y0+H*K1)
  17.   170   X0+=H
  18.   180   K3=fnF(X0,Y0+2*H*K2)
  19.   190   Y0+=H*(K0+2*K1+2*K2+K3)/3
  20.   200   next
  21.   210   return(Y0)
  22.